<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        img {
           height: 800px;
        }
    </style>
    <script type="text/javascript">
        window.onload = function (){
            var img4 = document.getElementById("img4");
            var imgArr = ["../../picture/img4.jpg","../../picture/img5.jpg","../../picture/img6.jpg","../../picture/img7.jpg","../../picture/img8.jpg"];
            var index = 0;
            var timer;
            var btn01 = document.getElementById("btn01");
            btn01.onclick = function () {
                clearInterval(timer);
              timer = setInterval(function () {
                    index++;
                    if(index >= imgArr.length) {
                        index = 0
                    };
                    img4.src = imgArr[index];
                },1000);

            }
            var btn02 = document.getElementById("btn02");
            btn02.onclick = function () {
                 clearInterval(timer);
            };
        };
    </script>
</head>
<body>
<img id="img4" src="../../picture/img4.jpg"/>
<button id="btn01">开始</button>
<button id="btn02">结束</button>

</body>
</html>